package com.xiaoshuidi.cloud.module.report.controller.finance;


import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.report.controller.finance.vo.DepositOwnerPageRespVO;
import com.xiaoshuidi.cloud.module.report.controller.finance.vo.DepositOwnerReqVO;
import com.xiaoshuidi.cloud.module.report.controller.finance.vo.ExportRespVO;
import com.xiaoshuidi.cloud.module.report.enums.ApiConstants;
import com.xiaoshuidi.cloud.module.report.service.finance.DepositOwnerService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

import static com.xiaoshuidi.cloud.framework.common.pojo.CommonResult.success;

/**
 * 业主押金报表
 */

@Slf4j
@Tag(name = "管理后台 -业主押金报表")
@RestController
@RequestMapping(ApiConstants.PREFIX+"/ownerDeposit")
public class DepositOwnerReportController {

    @Resource
    private DepositOwnerService depositOwnerService;


    @PostMapping("/page")
    @Operation(summary = "业主押金报表分页查询")
    public CommonResult<DepositOwnerPageRespVO> page(@RequestBody @Valid DepositOwnerReqVO reqVO) {
        log.info("DepositOwnerReportController page req{}",reqVO.toString());
        return success(depositOwnerService.page(reqVO));
    }

    /**
     * 押金报表出
     *
     * @return
     */
    @PostMapping("/export")
    public CommonResult<ExportRespVO> export(@RequestBody @Valid DepositOwnerReqVO req) {
        log.info("DepositOwnerReportController export req:{}",req.toString());
        return CommonResult.success(depositOwnerService.export(req));
    }

}
